package com.qf.controller;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.SessionAttributes;
import org.springframework.web.bind.support.SessionStatus;

@Controller
@SessionAttributes({"name","age"})//Model中的name和age会存入session中
public class UserController {
    @RequestMapping("/hello")
    public String hello(Model model){
        model.addAttribute("age","45");
        model.addAttribute("id","23");
        model.addAttribute("name","toms");

        return "hello";
    }
    @RequestMapping("/hello2")
    public String hello(SessionStatus status){
        status.setComplete();
        return "index";
    }
}
